<? include ("../init.php") ?>
<?php
  if(!isset($_GET['aid'])){
    redirect('index.php');
    exit();
  }
  $product_set_id = $_GET['aid'];
  
  function get_product_setname($product_set_id){
    $db2 = new DB(DB_NAME, DB_SERVER, DB_USER, DB_PWD);
    $db2->charset(DB_CHARSET);
    $sql = 'SELECT * FROM product_set WHERE product_set_id='.$product_set_id;
    $line = $db2->queryUniqueObject($sql);
    return $line->product_set_name;
  }
?>
<? include ("../header.php") ?>
<? include ("../menu.php") ?>
<? include ("submenu.php") ?>
<div id = "body">

<h1><?php echo get_product_setname($product_set_id); ?></h1>

<a href = "form_product.php?aid=<?php echo $product_set_id;?>" class = "add"><img src = "<?=ADMIN?>/images/icon-add.png">&nbsp;&nbsp;&nbsp;<?_l('add')?><?_l('product')?></a>

<div class = "clear"></div>

<div class = "page">
<?
  $count = $db->countOfAll('product_set');
  $start = setpage($count);
?>
</div>

<div class = "clear"></div>

<table class ="list">
  <tr>
    <th scope="col"><?_l('product-name')?></th>
    <th scope="col" width = "50"><?_l('edit')?></th>
    <th scope="col" width = "50"><?_l('delete')?></th>
  </tr>
<?
  $rss = $db->query("SELECT * FROM products WHERE product_set_id=$product_set_id ORDER BY product_title LIMIT $start,".PAGE);
  while ($line = $db->fetchNextObject($rss)){
?>
  <tr>
    <td><?=$line->product_title?></td>
    <td><a href = "edit_product.php?aid=<?=$line->product_id?>" class = "btn"><?_l('edit')?></a></td>
    <td><a href = "del_product.php?aid=<?=$line->product_id?>&setid=<?=$line->product_set_id?>" class = "btn" onClick = "return confirmSubmit()"><?_l('delete')?></a></td>
  </tr>
<?
  }
?>
</table>

</div>

<style>

</style>

<? include "../footer.php" ?>